package com.mipo.pdfview.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.mipo.pdfview.model.User;
import com.mipo.pdfview.view.ViewPDF;

@Controller()
@RequestMapping("/ExcelController")
public class PDFController {
	
	@RequestMapping("pdf")  
    public ModelAndView viewPDF(){  
        Map<String, Object> model = new HashMap<>();
        model.put("userList", getStudents());          
        return new ModelAndView(new ViewPDF(), model);  
    }  

    private List<User> getStudents() {
        List<User> userList = new ArrayList<>();
        User user = new User("1", "Tome", "Tom@qq.com", "123456");
        userList.add(user);
        return userList;
    }
}

